package com.og.backingbean;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotEmpty;

/**
 * @author Renaud DIANA
 *
 */
@Entity
@NamedQueries({@NamedQuery(name = "ApplicationHistory.findAll", query = "SELECT ah FROM ApplicationHistory ah ORDER BY ah.idApplicationHistory ASC")})
public class ApplicationHistory implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
	private int idApplicationHistory;
	private String comments;
	@NotNull
	@ManyToOne
	@JoinColumn(nullable = false)
	private Application application;
	@NotNull
	@NotEmpty
	@Size(max = 50)
	@Column(nullable = false, length = 50)
	private String version;
	@NotNull	
	@Past
	@Column(nullable = false)
	@Temporal(TemporalType.DATE)
	private Date date;
	@Column(columnDefinition = "Decimal(6,2) default '0.00'")
	private float price;
		
	/**
	 * Default constructor
	 */
	public ApplicationHistory() {
		// TODO Auto-generated constructor stub
	}

	public int getIdApplicationHistory() {
		return idApplicationHistory;
	}

	public void setIdApplicationHistory(int idApplicationHistory) {
		this.idApplicationHistory = idApplicationHistory;
	}

	public String getComments() {
		return comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}

	public Application getApplication() {
		return application;
	}

	public void setApplication(Application application) {
		this.application = application;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public float getPrice() {
		return price;
	}

	public void setPrice(float price) {
		this.price = price;
	}

	public String getVersion() {
		return version;
	}
	
	public void setVersion(String version) {
		this.version = version;
	}
	
}
